package edu.csula.cs575;

import java.util.ArrayList;

import android.graphics.drawable.Drawable;
import android.widget.TextView;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class MapOverlay extends ItemizedOverlay<OverlayItem>
{
	private static TextView textView;
	private boolean onTapEnabled = true;

	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();

	public MapOverlay(Drawable defaultMarker)
	{
		super(boundCenterBottom(defaultMarker));
	}

	public static void setTextView(TextView v)
	{
		textView = v;
	}

	protected OverlayItem createItem(int i)
	{
		return mOverlays.get(i);
	}

	public int size()
	{
		return mOverlays.size();
	}

	public void addOverlay(OverlayItem overlay)
	{
		mOverlays.add(overlay);
		populate();
	}

	public void setOnTapEnable(boolean enable)
	{
		onTapEnabled = enable;
	}

	protected boolean onTap(int index)
	{
		if (onTapEnabled)
		{
			OverlayItem item = mOverlays.get(index);
			
			return true;
		}

		return false;
	}
}
